package GUI.almacen;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

public class PedidosSur extends JPanel implements ActionListener {

	private static final long serialVersionUID = 1L;

	private Boton btn_consultar;
	private Boton btn_pendientes;
	private Boton btn_informe;
	private Pedidos _pedidos;
	private DialogoConsultarPedido _dcp;
	private DialogoPedidosPendientes _dpp;


	public PedidosSur(Pedidos pedidos) {
         this._pedidos=pedidos;
         this.setBorder(new TitledBorder("Opciones"));
		 this.setLayout(new GridLayout(1,3));


		 
		 btn_consultar=new Boton("Consultar");
		 btn_consultar.setActionCommand("Consultar");
		 btn_consultar.addActionListener(this);
		 this.add(btn_consultar);
 
		 btn_pendientes=new Boton("Pendientes");
		 btn_pendientes.setActionCommand("Pendientes");
		 btn_pendientes.addActionListener(this);
		 this.add(btn_pendientes);

		 btn_informe=new Boton("Informe");
		 btn_informe.setActionCommand("Informe");
		 btn_informe.addActionListener(this);
		 this.add(btn_informe);
 
	}

 
	private void accion_al_consultar() {
		_dcp=new DialogoConsultarPedido(_pedidos);
		_dcp.setVisible(true);
	}

	private void accion_al_pedir() {
		_dpp= new DialogoPedidosPendientes(_pedidos);
		_dpp.setVisible(true);
		
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getActionCommand().equalsIgnoreCase("consultar")){
			accion_al_consultar();
		}else if(e.getActionCommand().equalsIgnoreCase("pendientes")){
			accion_al_pedir();
		}

	}



}

